for _ in range(int(input())):
n=int(input())
s=input()
ss=list(s)
ss.sort()
ls=[]
for i in range(n-1):
if ss[i]!=ss[i+1]:
ls.append(ss[i])
ls.append(ss[n-1])
d=dict()
i=0;j=len(ls)-1
while i<=j:
d[ls[i]]=ls[j]
d[ls[j]]=ls[i]
i+=1
j-=1
ans=[]
for a in s:
ans.append(d[a])
print(''.join(ans))
Partitioning binary strings | Special sets |
Smallest chosen word | Going to office |
Color the boxes | Missing numbers |
Maximum sum | 13 Reasons Why |
Friend's Relationship | Health of a person |
Divisibility | A. Movement |
Numbers in a matrix | Sequences |
Split houses | Divisible |
Three primes | Coprimes |
Cost of balloons | One String No Trouble |
Help Jarvis! | Lift queries |
Goki and his breakup | Ali and Helping innocent people |
Book of Potion making | Duration |
Birthday Party | e-maze-in |
Bricks Game | Char Sum |